<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../backend/inc/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>手机找回</title>
    <link rel="stylesheet" type="text/css" href="${contextPath}/static/threeVideo/css/style.css"/>
</head>
<body>
<div class="bg">
    <div class="logo"></div>
    <div class="content content1">
        <div class="input-box"><input type="text" id="mobile" placeholder='请输入手机号' maxlength="11"/></div>

        <div class="input-box">
            <input type="text" id="code" placeholder='请输入验证码' maxlength="6"/>
            <div class="yz-btn">获取验证码</div>
        </div>

        <div class="c-btn" onclick="checkCode()">下一步</div>
        <a href="${contextPath}/company/login" class="c-a">返回登录</a>
    </div>
</div>

<script type="text/javascript" src="${contextPath}/static/threeVideo/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="${contextPath}/static/threeVideo/js/index.js"></script>
</body>

<script type="text/javascript">
    function sendCode() {
        if (!checkMobile($('#mobile').val())) {
            alert('手机号格式不正确');
            return false;
        } else {
            return true;
        }
    }

    function checkCode() {
        if (sendCode()) {
            var code = $('#code').val();
            if (null != code && code != '') {
                $.ajax({
                    dataType: 'json',
                    url: '/slsp/company/checkCode',
                    data: {
                        mobile: $('#mobile').val(),
                        code: code,
                        type: 2
                    },
                    success: function (data) {
                        if (data == 0) {
                            window.location.href = '${contextPath}/company/setPassword?mobile=' + $('#mobile').val() + '&code=' + code;
                        } else {
                            alert('验证码不正确');
                        }
                    }
                });
            } else {
                alert('请输入验证码');
            }
        }
    }
</script>

</html>